package com.xuptGurantee.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xuptGurantee.system.entity.Activity;
import com.xuptGurantee.system.mapper.ActivityMapper;
import com.xuptGurantee.system.service.ActivityService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class ActivityServiceImpl extends ServiceImpl<ActivityMapper, Activity> implements ActivityService {
    @Resource
    ActivityService activityService;

    @Override
    public List<Activity> getPubList() {
        LambdaQueryWrapper<Activity> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.orderByDesc(Activity::getActivityDate).last("limit 0 , 3");
        return activityService.list(queryWrapper);
    }
}
